// -----------------------------
// Author: 		Dhaenens Gert	
// Creation: 	2/21/2015 7:40:03 PM				
// -----------------------------

#include "CMutex.h"

namespace Flow
{

	CMutex::CMutex()
	{
		InitializeCriticalSection(&m_Section);
	}

	CMutex::~CMutex()
	{
		DeleteCriticalSection(&m_Section);
	}

	void CMutex::Release()
	{
		delete this;
	}


	void CMutex::Lock()
	{
		EnterCriticalSection(&m_Section);
	}
	Bool CMutex::TryLock()
	{
		return (TryEnterCriticalSection(&m_Section) == TRUE);
	}
	void CMutex::Unlock()
	{
		LeaveCriticalSection(&m_Section);
	}

}